﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="GLForm.aspx.cs" Inherits="RenShiKaoQin.Account.GLForm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true">
    </ajaxToolkit:ToolkitScriptManager>
    <div align="center">
    <table border="2" rules="all" cellpadding="5" width="200px"><tr style="font-size:23px;font-weight:bold"><td>用&nbsp;&nbsp;户&nbsp;&nbsp;授&nbsp;&nbsp;权</td></tr></table>
    您可以在这里对用户进行授权,输入姓名的拼音首字母来查找用户：<asp:TextBox ID="tbInputCode" runat="server" AutoPostBack="True"
        EnableViewState="False"></asp:TextBox><asp:Button ID="btnSearch" runat="server" Text="查找" />
    <asp:GridView ID="gvSQ" runat="server" AutoGenerateColumns="False" DataKeyNames="FEmployeeID"
        DataSourceID="sqlSQ" EmptyDataText="没有符合条件的数据" CellPadding="4" ForeColor="#333333"
        GridLines="None" Font-Size="17px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="FName" HeaderText="姓名" SortExpression="FName" />
            <asp:BoundField DataField="FEmployeeID" HeaderText="档案号" ReadOnly="True" SortExpression="FEmployeeID" />
            <asp:BoundField DataField="FPublicID" HeaderText="工作编码" SortExpression="FPublicID" />
            <asp:TemplateField HeaderText="请假审批" SortExpression="IsExaminant">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("IsExaminant") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("IsExaminant") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="请假复核" SortExpression="IsChecker">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("IsChecker") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("IsChecker") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="会议审批" SortExpression="IsMExaminant">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox4" runat="server" 
                        Checked='<%# Bind("IsMExaminant") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox4" runat="server" 
                        Checked='<%# Bind("IsMExaminant") %>' Enabled="True" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="会议复核" SortExpression="IsMChecker">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox5" runat="server" 
                        Checked='<%# Bind("IsMChecker") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox5" runat="server" Checked='<%# Bind("IsMChecker") %>' 
                        Enabled="True" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="管理权限" SortExpression="IsAdmin">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox3" runat="server" Checked='<%# Bind("IsAdmin") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox3" runat="server" Checked='<%# Bind("IsAdmin") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="职能管理" 
                SortExpression="IsZNGL">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBoxZNGL" runat="server" Checked='<%# Bind("IsZNGL") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBoxZNGL" runat="server" Checked='<%# Bind("IsZNGL") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="领导查看" SortExpression="IsLeader">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBoxLeader" runat="server" Checked='<%# Bind("IsLeader") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBoxLeader" runat="server" Checked='<%# Bind("IsLeader") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="学习审批" SortExpression="IsLeader">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBoxStudy" runat="server" Checked='<%# Bind("IsStudyManager") %>' />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBoxStudy" runat="server" Checked='<%# Bind("IsStudyManager") %>' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:Button ID="btnUpdate" runat="server" Text="点击此按钮以保存更改" OnClick="btnUpdate_Click" />
    <asp:SqlDataSource ID="sqlSQ" runat="server" ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>"
        SelectCommand="SELECT TKQEmployee.FEmployeeID, TKQEmployee.FPassword, TKQEmployee.IsExaminant, TKQEmployee.IsChecker, TKQEmployee.IsAdmin, TEmployee.FName, TEmployee.FInputCode, TEmployee.FPublicID, TKQEmployee.IsMExaminant, TKQEmployee.IsMChecker, TKQEmployee.IsZNGL, TKQEmployee.IsLeader, TKQEmployee.IsStudyManager FROM TKQEmployee INNER JOIN TEmployee ON TKQEmployee.FEmployeeID = TEmployee.FEmployeeID WHERE (TEmployee.FInputCode LIKE @InputCode + '%') ORDER BY TKQEmployee.FEmployeeID"
        
        
        
            
            
            
            
            UpdateCommand="UPDATE TKQEmployee SET IsExaminant = @IsExaminant, IsChecker = @IsChecker, IsAdmin = @IsAdmin, IsMExaminant = @IsMExaminant, IsMChecker = @IsMChecker, IsZNGL = @IsZNGL, IsLeader = @IsLeader, IsStudyManager = @IsStudyManager WHERE (FEmployeeID = @FEmployeeID)">
        <SelectParameters>
            <asp:ControlParameter ControlID="tbInputCode" Name="InputCode" PropertyName="Text" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="IsExaminant" />
            <asp:Parameter Name="IsChecker" />
            <asp:Parameter Name="IsAdmin" />
            <asp:Parameter Name="IsMExaminant" />
            <asp:Parameter Name="IsMChecker" />
            <asp:Parameter Name="IsZNGL" />
            <asp:Parameter Name="IsLeader" />
            <asp:Parameter Name="IsStudyManager" />
            <asp:Parameter Name="FEmployeeID" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <table border="2" rules="all" cellpadding="5" width="200px"><tr style="font-size:23px;font-weight:bold"><td>请&nbsp;&nbsp;假&nbsp;&nbsp;审&nbsp;&nbsp;批&nbsp;&nbsp;状&nbsp;&nbsp;态</td></tr></table>
    <div>您可在这里查找用户申请的处理情况</div>输入姓名<asp:TextBox ID="tbNameSec" runat="server" 
        Width="90px" EnableViewState="False" ViewStateMode="Disabled"></asp:TextBox>或者输入申请起始日期的时间段从<asp:TextBox
        ID="tbStart" runat="server" Width="120px" EnableViewState="False" 
        ViewStateMode="Disabled"></asp:TextBox><ajaxToolkit:CalendarExtender ID="caltbStart"
            TargetControlID="tbStart" runat="server" Format="yyyy-MM-dd" DefaultView="Months">
        </ajaxToolkit:CalendarExtender>
    至<asp:TextBox ID="tbEnd" runat="server" Width="120px" EnableViewState="False" 
        ViewStateMode="Disabled"></asp:TextBox><ajaxToolkit:CalendarExtender
        ID="CalendarExtender1" TargetControlID="tbEnd" runat="server" Format="yyyy-MM-dd"
        DefaultView="Months">
    </ajaxToolkit:CalendarExtender>
    来<asp:Button ID="btnSearchSec" runat="server" Text="查询" 
        onclick="btnSearchSec_Click" />
    <asp:GridView ID="gvJC" runat="server" CellPadding="4" DataSourceID="sqlJC" ForeColor="#333333"
        GridLines="None" AutoGenerateColumns="False" DataKeyNames="SerialNO" 
        EmptyDataText="没有符合条件的数据" AllowPaging="True" Font-Size="15px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="档案号" SortExpression="FEmployeeID">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("FEmployeeID") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox1" runat="server" Text='<%# Bind("FEmployeeID") %>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="姓名" SortExpression="FName">
            <ItemStyle Width= "45px" />
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("FName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox2" runat="server" Text='<%# Bind("FName") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="科室" SortExpression="DeptName">
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("DeptName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox3" runat="server" Text='<%# Bind("DeptName") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="起始日期">
                <ItemTemplate>
                    <asp:Label ID="lbStartDate" runat="server" Text='<%# ((DateTime)Eval("StartDate")).ToString("yyyy-MM-dd") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="gvtbStart" runat="server" Width="70px" Text='<%# Bind("StartDate","{0:yyyy-MM-dd}") %>' /><ajaxToolkit:CalendarExtender ID="calgvtbStart"
            TargetControlID="gvtbStart" runat="server" Format="yyyy-MM-dd" DefaultView="Months">
        </ajaxToolkit:CalendarExtender>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="结束日期" SortExpression="EndDate">
                <ItemTemplate>
                    <asp:Label ID="lbEndDate" runat="server" Text='<%# ((DateTime)Eval("EndDate")).ToString("yyyy-MM-dd") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="gvtbEnd" runat="server" Width="70px" Text='<%# Bind("EndDate","{0:yyyy-MM-dd}") %>' /><ajaxToolkit:CalendarExtender ID="calgvtbEnd"
            TargetControlID="gvtbEnd" runat="server" Format="yyyy-MM-dd" DefaultView="Months">
        </ajaxToolkit:CalendarExtender>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="类别" SortExpression="KQType">
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("KQType") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlType" runat="server" DataSourceID="sqlType" 
                        DataTextField="FName" DataValueField="FKQTypeCode" SelectedValue='<%# Bind("TypeCode") %>'>
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="sqlType" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
                        SelectCommand="SELECT FKQTypeCode, FName FROM TDictKQType">
                    </asp:SqlDataSource>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="备注" SortExpression="Memo">
            <ItemStyle Width= "160px" />
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("Memo") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox5" runat="server" Text='<%# Bind("Memo") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="已审批" SortExpression="ExamStatus">
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("ExamStatus") %>' 
                        Enabled="false" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" 
                        Checked='<%# Bind("ExamStatus") %>' Enabled="false" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="已复核" SortExpression="CheckStatus">
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" 
                        Checked='<%# Bind("CheckStatus") %>' Enabled="false" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" 
                        Checked='<%# Bind("CheckStatus") %>' Enabled="false"/>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="已阅" SortExpression="ReadStatus">
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox3" runat="server" Checked='<%# Bind("ReadStatus") %>' 
                        Enabled="false" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox3" runat="server" 
                        Checked='<%# Bind("ReadStatus") %>' Enabled="false" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="审批日期" SortExpression="ExamDate">
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" 
                        Text='<%# Bind("ExamDate", "{0:yyyy-MM-dd}") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox6" runat="server" Text='<%# Bind("ExamDate","{0:yyyy-MM-dd}") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="审批人" SortExpression="ExamerName">
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("ExamerName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox7" runat="server" Text='<%# Bind("ExamerName") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="复核日期" SortExpression="CheckDate">
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server" 
                        Text='<%# Bind("CheckDate", "{0:yyyy-MM-dd}") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox8" runat="server" Text='<%# Bind("CheckDate","{0:yyyy-MM-dd}") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="复核人" SortExpression="CheckerName">
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server" Text='<%# Bind("CheckerName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="TextBox9" runat="server" Text='<%# Bind("CheckerName") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:CommandField HeaderText="编辑" ShowEditButton="True" ShowHeader="True" 
                ShowCancelButton="False" EditText="编辑" UpdateText="更新" DeleteText="删除"
                ShowDeleteButton="True">
                <ItemStyle Width= "70px" /></asp:CommandField>
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:SqlDataSource ID="sqlJC" runat="server" 
        ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
        onselecting="sqlJC_Selecting" 
        
            SelectCommand="SELECT TKQRequestRecord.FEmployeeID, TKQRequestRecord.StartDate, TKQRequestRecord.EndDate, TKQRequestRecord.TypeCode, TKQRequestRecord.Memo, TKQRequestRecord.ExamStatus, TKQRequestRecord.CheckStatus, TKQRequestRecord.SerialNO, TKQRequestRecord.ReadStatus, TKQRequestRecord.CheckDate, TKQRequestRecord.ExamDate, TEmployee_1.FName, TDictDept.FName AS DeptName, (SELECT FName FROM TEmployee WHERE (FEmployeeID = TKQRequestRecord.ExamerID)) AS ExamerName, (SELECT FName FROM TEmployee AS TEmployee_2 WHERE (FEmployeeID = TKQRequestRecord.CheckerID)) AS CheckerName, TDictKQType.FName AS KQType FROM TKQRequestRecord INNER JOIN TEmployee AS TEmployee_1 ON TKQRequestRecord.FEmployeeID = TEmployee_1.FEmployeeID INNER JOIN TDictDept ON TDictDept.FDeptCode = TKQRequestRecord.DeptCode INNER JOIN TDictKQType ON TKQRequestRecord.TypeCode = TDictKQType.FKQTypeCode WHERE (TEmployee_1.FName = @FName) OR (TKQRequestRecord.StartDate BETWEEN @Start AND @End )" 
            
            UpdateCommand="UPDATE TKQRequestRecord SET StartDate = @StartDate, EndDate = @EndDate, TypeCode = @TypeCode WHERE (SerialNO = @SerialNO)" 
            DeleteCommand="DELETE FROM TKQRequestRecord WHERE (SerialNO = @SerialNO)">
        <DeleteParameters>
            <asp:Parameter Name="SerialNO" />
        </DeleteParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="tbNameSec" Name="FName" PropertyName="Text" 
                Type="String" />
            <asp:ControlParameter ControlID="tbStart" Name="Start" PropertyName="Text" 
                Type="DateTime" />
            <asp:ControlParameter ControlID="tbEnd" Name="End" PropertyName="Text" 
                Type="DateTime" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="StartDate" />
            <asp:Parameter Name="EndDate" />
            <asp:Parameter Name="TypeCode" />
            <asp:Parameter Name="SerialNO" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <div style="padding-top:20px">
    <table border="2" rules="all" cellpadding="5" width="200px"><tr style="font-size:23px;font-weight:bold"><td>导&nbsp;&nbsp;出&nbsp;&nbsp;数&nbsp;&nbsp;据</td></tr></table>
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Account/GLExport.aspx" Text="导出数据"></asp:HyperLink>
    </div>
    </div>
    
</asp:Content>
